From 2e11fd347ebbb43c926f7c2b95f1117783ff00ef Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 6 Sep 2007 16:42:58 +0000 Subject: [PATCH] Add the Postgres slash search fix to existing installations. --- RELEASE-NOTES | 1 + .../postgres/archives/patch-ts2pagetitle.sql | 13 +++++++++++++ maintenance/updaters.inc | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 maintenance/postgres/archives/patch-ts2pagetitle.sql diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e1aef60d3b..ee9b0cfcd2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -23,6 +23,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === New features in 1.12 === === Bug fixes in 1.12 === +* Subpages are now indexed for searching properly when using Postgres === API changes in 1.12 === diff --git a/maintenance/postgres/archives/patch-ts2pagetitle.sql b/maintenance/postgres/archives/patch-ts2pagetitle.sql new file mode 100644 index 0000000000..4ac985e375 --- /dev/null +++ b/maintenance/postgres/archives/patch-ts2pagetitle.sql @@ -0,0 +1,13 @@ +CREATE OR REPLACE FUNCTION ts2_page_title() +RETURNS TRIGGER +LANGUAGE plpgsql AS +$mw$ +BEGIN +IF TG_OP = 'INSERT' THEN + NEW.titlevector = to_tsvector('default',REPLACE(NEW.page_title,'/',' ')); +ELSIF NEW.page_title != OLD.page_title THEN + NEW.titlevector := to_tsvector('default',REPLACE(NEW.page_title,'/',' ')); +END IF; +RETURN NEW; +END; +$mw$; diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 3c9720445f..beadacfa52 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1526,5 +1526,9 @@ function do_postgres_updates() { dbsource($ni[2]); } + # Tweak the page_title tsearch2 trigger to filter out slashes + # This is create or replace, so harmless to call if not needed + dbsource(archive("patch-ts2pagetitle.sql")); + return; } -- 2.20.1